# ----------------------------------------------------------------------
# ' this file uses pain diagnosis files for each quarter
# ' to generate a list of pain patients
# ' by BK (bl11@indiana.edu)
# ----------------------------------------------------------------------

load_library = c('bit64','data.table','fst','future.apply','stringr','logger')
invisible(lapply(load_library, function(x) library(x, character.only=TRUE, quietly= TRUE)))
options(scipen=999)

bucket = file.path('/N','project','iuni_doctorshopping')

# read arguments
args=commandArgs(TRUE)
infile = args[[1]]
outfile = args[[2]]

data = fread(infile)

# make a unique list for overdose patients
udata = unique(data[, 'PATID'])

fwrite(udata, outfile)



